package cn.milolab.djback.controller;

import cn.milolab.djback.annotation.DJRoleCheck;
import cn.milolab.djback.bean.entity.Employee;
import cn.milolab.djback.bean.response.SalaryResponse;
import cn.milolab.djback.service.SalaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @author 叶欣委
 */
@RestController
@RequestMapping("/salary")
public class SalaryController {
    @Autowired
    SalaryService salaryService;

    @GetMapping
    @DJRoleCheck(Employee.RoleLevel.EMPLOYEE)
    public List<SalaryResponse> getSalary(@RequestParam Date startTime, @RequestParam Date endTime) {
        return salaryService.getSalary(startTime, endTime);
    }

}
